export const useProductClassification = (productList: []) => {
  return productList.reduce((pre: any, cur: any) => {
    if(pre?.length && pre?.find((product: any) => product.size === cur.size &&  cur.id === product.id)) {
      pre.forEach((product: any)=> {
      if (product.size === cur.size &&  cur.id === product.id) {
          product.quantity++
        }
      })
      return [...pre]
    } else {
      return [...pre, {...cur, quantity: 1}]
    }
  }, [])
}
